$(document).ready(function() {
	$(".linkBt").mouseover(function(event) {
		$(this).css('color', 'red');
	});
	$(".linkBt").mouseout(function(event) {
		$(this).css('color', '#666666');
	});
	//返回首页
	$("#toHome").click(function(event) {
		window.location.href= "./home.html";
	});
});

function getExercise(num,typenum){
	$.ajax({
		url: '../question/getQuestion/'+num+"/"+typenum,
		type: 'GET',
		dataType: 'json',
		data: {level: '0'},
		success: function(data){
			console.log("ajax success!!!");
			var list = data.qList;
			for(var i=0;i<list.length;i++){
				var idNum = i+1;
				var html = "<span class='pro'>" + list[i].qdetail+"=" + "</span>";
				html = html +"<input type='text' id='inp"+i+"' class='inputC' size='5'/>";
				html = html +"<span id='result"+i+"'></span>" + "</br>"
				var html = html + "<span class='hiddenC'> 正确答案-->" + list[i].tanswer + "</span>";
				$("#num"+idNum).html(html);
			}
			$("#showA").click(function(event) {
				$(".hiddenC").each(function(index, el) {
					$(this).removeClass('hiddenC').addClass('showC');
				});
				$(".inputC").each(function(index, el) {
					var value = this.value;
					var num = this.id;
					var index = num.substring(3,num.length);
					if(parseFloat(value.toString()) != parseFloat(list[parseInt(index)].tanswer.toString())){
						$("#result"+index).html("　F").addClass('result');
					}else{
						$("#result"+index).html("　T").addClass('result');
					}
				});
			});
		},
		error: function(){
			console.log("ajax fail!!!");
			alert(errorThrown);
		}
	});
}